library(tidyverse)

DATA <- tribble(
  ~GROUP        , ~PE , ~CILO, ~CIHI,
  "Biden voters", 59.8,  58.7,  60.8,
  "Trump voters", 84.7,  84.0,  85.4,
  "Other voters", 62.1,  58.4,  65.9)

DATA$GROUP <- factor(DATA$GROUP, levels=c("Biden voters", "Other voters", "Trump voters"))

ggplot(data=DATA, aes(x=GROUP, y=PE, fill=GROUP)) +
  geom_col(size=1.1, color="black", width=0.85) + 
  geom_errorbar(aes(ymin=CILO, ymax=CIHI), width=0.25) +
  geom_text(aes(x=GROUP, y=CIHI+5, label=sprintf("%0.0f", PE)), size=5.5) +
  scale_fill_manual(values=c("Biden voters"="blue3", "Trump voters"="red3", "Other voters"="gray")) +
  scale_y_continuous(limits=c(0,100), breaks=seq(0,100,10), expand=c(0,0), name="%") +
  labs(title="Mean rating about police", subtitle="on a 0-to-100 scale", caption="Error bars are 83.4% confidence intervals.\nData source: American National Election Studies 2020 Time Series Study.\nPlot by [your name here].") +
  theme(
    axis.text.x        = element_text(size=15, color="black", margin=margin(t=7, b=7)),
    axis.text.y        = element_blank(),
    axis.ticks.x       = element_blank(),
    axis.ticks.y       = element_blank(),
    axis.title.x       = element_blank(),
    axis.title.y       = element_blank(),
    legend.position    = "none",
    panel.background   = element_rect(fill="white"),
    panel.border       = element_blank(),
    panel.grid.major.x = element_blank(),
    panel.grid.major.y = element_blank(),
    panel.grid.minor.x = element_blank(),
    panel.grid.minor.y = element_blank(),
    plot.caption       = element_text(size=12, hjust=0, margin=margin(t=7)),
    plot.margin        = unit(c(t=0.5, r=0.5, b=0.5, l=0.5), "cm"),
    plot.subtitle      = element_text(size=18,              hjust=0.5, margin=margin(t=0, b=10)),
    plot.title         = element_text(size=20, face="bold", hjust=0.5, margin=margin(t=0, b=5)))

ggsave(file="Plot 1 finished.wmf", width=6.5, height=6)
